Pattern
Syntax "pattern": "comma-delimited symbols" Description The pattern keyword of a recipe converts a shapeless recipe into a shaped recipe by specifying that the content must be arranged in a specific pattern on the crafting grid instead of being placed in any arbitrary order in any slot of the crafting grid. Each new symbol in the pattern corresponds to the first item in the content. If a symbol is repeated, it takes on the same value as it had previously. If the pattern contains more symbols than the content, the content contains more identifiers than the pattern, or the pattern contains an invalid arrangement of spaces, symbols, and commas, the recipe will fail silently. To specify that a given slot must remain blank on the crafting grid, use a space instead of any other symbol. The arrangement of commas separated by spaces determines whether the crafting recipe can be performed on a 2x2 or 3x3 crafting grid. You can also omit certain sections of the crafting recipe, which will allow the ingredients to be arranged anywhere on the crafting grid in that shape instead of being restricted to specific slots on a 3x3 crafting grid. The following patterns are possible: (Theoretically a 1x1 pattern is also possible, but there is no advantage to specifying a pattern of 1 item versus simply creating a shapeless recipe for that single item.) Example { "items": { "boneClub": { "name": "Bone Club", "id": 18512, "icon": "img/boneclub.png", "type": "sword", "uses": 64, "damage": 5 } }, "recipes": { "boneClub": { "pattern": "B,B,S", "content": "bone,stick" } } } This recipe creates a bone club out of two bones and one stick. The first new symbol in the crafting recipe, "B", is compared against the content to find that it should correspond to a bone. The second "B" is also interpreted the same as the first. The second new symbol in the recipe, "S", is compared against the content to find that it should correspond to a stick. The bones must be placed vertically above the stick, but they can be arranged on the left, centre, or right column of the crafting grid without being rejected. If the pattern was: "pattern": " B , B , S ", then the recipe could only be created if the bones and stick were arranged specifically in the centre column of the grid. This can be used if you would like to enforce "precision" in the crafting recipe, but generally is viewed as both an inconvenience and a bug. Unless there is a compelling reason, ensure that unnecessary columns and rows in your recipe are removed by following the shapes listed in the table above. Other notes * To enforce a crafting recipe with two items that can only be crafted on a crafting grid, you can use a 1x3 or 3x1 pattern in the format "A, ,B" or "A B". * Shaped recipes can be made "semi-shapeless" by creating copies of those recipes (using the product keyword) with appropriate rearrangements in their order. As an extension of the above example, the following crafting recipes would be necessary to allow 2 items to be placed in any orientation on a 3x3 crafting grid while still forbidding them from a 2x2 crafting grid: ** "A B" ** "A , B" ** "A , , B" ** "A , , B" ** "A, ,B" ** " A, ,B " ** " A, ,B " ** " A,B " ** and all of the same recipes again, but with the order of A and B switched within the content. ** For fairly obvious reasons, this is why shapeless recipes were introduced. Otherwise, however, there is currently no way to enforce a specific size of crafting grid without using a method similar to this. See also: * recipe * shaped recipe * content Category:Custom Content Creation Category:Custom Content Creation/Recipe